MYSQL_USER = root
MYSQL_PASSWORD = 123 

all: snmp_compile gsp billing_server_compile

create_db:
	(cd gsp-banking/db ; mysql --user=$(MYSQL_USER) --password=$(MYSQL_PASSWORD) -f < schema.sql )

create_and_fill_db:
	(cd gsp-banking/db ; mysql --user=$(MYSQL_USER) --password=$(MYSQL_PASSWORD) -f < schema.sql; mysql --user=$(MYSQL_USER) --password=$(MYSQL_PASSWORD) -f < data.sql )


snmp_compile:
	(cd snmp/ ; mvn compile)

snmp_start: snmp_compile
	(cd snmp/target/classes/ ; sudo java -classpath ".:$$HOME/.m2/repository/org/snmp4j/snmp4j/2.0.3/snmp4j-2.0.3.jar:$$HOME/.m2/repository/org/snmp4j/snmp4j-snmp/2.0.5/snmp4j-snmp-2.0.5.jar/:$$HOME/.m2/repository/org/slf4j/slf4j-api/1.5.10/slf4j-api-1.5.10.jar:$$HOME/.m2/repository/org/slf4j/slf4j-log4j12/1.5.10/slf4j-log4j12-1.5.10.jar:$$HOME/.m2/repository/log4j/log4j/1.2.15/log4j-1.2.15.jar" ru/aptu/snmp_trap/manager/TrapReceiver)

gsp: billing_utils
	(cd gsp-banking/ ; mvn package)

billing_utils:
	(cd billing-utils/ ; mvn install)

billing_server_compile: billing_utils
	(cd billing-server/ ; mvn package)

billing_server_start: billing_server_compile
	(cd billing-server/target ; java -jar billing-server-0.5.jar ../srvKeystore 123456 )
